from customExceptions import VarNotFoundExcpt

class environment:
	def __init__(self, bindingName, bindingValue, env=None):
		self.bindingName = bindingName
		self.bindingValue = bindingValue
		self.nextEnv = env
        
	def getVarRef(self,name):
		if (name == self.bindingName):
			return self.bindingValue
		elif(self.nextEnv != None):
			return self.nextEnv.getVarRef(name)
		else:
			raise VarNotFoundExcpt(name)
	
	def mutateVarRef(self, name, value):
		if (name == self.bindingName):
			self.bindingValue = value
		elif(self.nextEnv != None):
			return self.nextEnv.getVarRef(name)
		else:
			raise VarNotFoundExcpt(name)
                

class expression:
	def evaluate(self, env):
		print "don't call on base class"
                
class value(expression):
	def evalutate(self):
		print "don't call base class types"
	def returnType(self):
		print "don't call base class types"
                


